//
//  Town.swift
//  Town
//
//  Created by 左忠飞 on 2021/8/4.
//

import Foundation

struct Town {
    var population = 5_422
    var numberOfStoplights = 4
    
    func printDescription(){
        print("Pupulation: \(population),number of stoplights: \(numberOfStoplights)")

    }
    
    //如果结构体的实例方法要修改结构体的属性,必须标记为mutating
    mutating func changePopulation(by amount:Int){
        population += amount
    }
}
